package HomeWork;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
/*
 *  "dasdsawqeqw"  1
 *   输出:
 *   e
 *   "dasdsawqeqw"  2
 *   输出:
 *   d
 *   a
 *   s
 *   w
 *   q*/
public class work03 {
    public static void main(String[] args) {
        Map<Character,Integer> map=new HashMap<>();
        System.out.println("请输入字符串：");
        Scanner sc=new Scanner(System.in);
        String y=sc.next();
        System.out.println("请输入个数：");
        int x=sc.nextInt();

        char [] chararray=y.toCharArray();
        for (char c : chararray) {
            if(map.containsKey(c)) {
                Integer value=map.get(c);
                value++;
                map.put(c, value);

            }else{
                map.put(c, 1);
            }
        }
        for(Entry<Character, Integer> e:map.entrySet()){
            if(e.getValue()==x){
                System.out.println(e.getKey());
            }
        }
    }
}